package com.xuanyue.componentauth.exception;

import com.xuanyue.componentbasics.result.Result;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

@ResponseBody
@ControllerAdvice
public class ExceptionHandle {

    @ExceptionHandler(value = NotFindTokenException.class)
    public Result notFindToken(){
        return Result.fail(501,"需要登录后访问");
    }

    @ExceptionHandler(value = LoginExpiredException.class)
    public Result loginExpired(){
        return Result.fail(501,"登录信息失效,请重新登录");
    }

}
